<?php
	header('content-type:text/html;charset="utf-8"');
	error_reporting(0);
    require_once 'conn.php';
	require_once "je.php";
	$conn=new mysqli($hn,$un,$pw,$db);
	if($conn->connect_error) die($conn->connect-error);
	
	//$uname=$_REQUEST['uname'];
	//$uemail=$_REQUEST['uemail'];
    //$uphone=$_REQUEST['uphone'];
    //$mes=$_REQUEST['mes'];
    
    $json=file_get_contents("php://input");
	$data = json_decode($json,true);
	
	$aname=$data['imagename'];
	$md=$data['img_src'];
	$file=$data['category'];
	
	if(isset($aname)){

       	$query="insert into images(imagename,img_src,category) value('{$aname}','{$md}','{$file}')";
		$conn->query('set names utf8');
		$result=$conn->query($query);
		if(!$result) die($conn->error);
		$json_arr = array("code"=>1,"info"=>"添加成功");
    	$json_obj = my_json_encode($json_arr);
		echo $json_obj;
	    $result->close();
		$conn->close();	
	}
	else{
		$json_arr = array("code"=>2,"info"=>"数据有误");
    	$json_obj = my_json_encode($json_arr);
		echo $json_obj;
	}
    
?>